@use 'sass:map';
@use '../../token-utils';

// The prefix used to generate the fully qualified name for tokens in this file.
$prefix: (mdc, dialog);

/// Generates the tokens for MDC dialog
/// @param {Map} $systems The MDC system tokens
/// @param {Boolean} $exclude-hardcoded Whether to exclude hardcoded token values
/// @param {Map} $token-slots Possible token slots
/// @return {Map} A set of tokens for the MDC dialog
@function get-tokens($systems, $exclude-hardcoded, $token-slots) {
  $tokens: token-utils.get-mdc-tokens('dialog', $systems, $exclude-hardcoded);
  $tokens: token-utils.rename-map-keys($tokens, (
    headline-color: subhead-color,
    headline-font: subhead-font,
    headline-line-height: subhead-line-height,
    headline-size: subhead-size,
    headline-tracking: subhead-tracking,
    headline-weight: subhead-weight,
  ));

  @if map.get($tokens, container-elevation) != null {
    $tokens: map.merge($tokens, (
      // The spec has the dialog at an elevation of 3 which is consistent with the current
      // version of the tokens (0_161), however both the designs and MDC's implementation
      // have the elevation set to 0. Set it manually to 0 here since the value in the
      // exported tokens is likely outdated.
      container-elevation: 0,

      // This color needs to be supplied for MDC to produce the shadow. Technically we don't
      // have to provide it since the elevation is set to 0 above, but we do it in case
      // the value changes in the future.
      container-shadow-color: #000,
    ));
  }

  @return token-utils.namespace-tokens($prefix, $tokens, $token-slots);
}
